import React, { Component } from 'react';
import {withRouter} from "react-router-dom";

class Home extends Component {

    constructor(props) {
        super(props);
        this.state = {
            redirect:false
        };
        this.gotoAddPrize= this.gotoAddPrize.bind(this);
    }

    gotoAddPrize(){
        console.log('ok,ok,ok');
        this.props.history.push("/addPrize");
        this.setState({
            redirect:true
        });
    }

    render(){
        // if (this.state.redirect) {
        //     return <Redirect  to="/addPrize"/>
        // }
        return(

            <div>
                {/* <Link to="/addPrize" >lllllll</Link> */}
                <button onClick={this.gotoAddPrize} >添加</button>
                {/* <a href="/addPrize">MMMMMMM</a> */}
            </div>
        );
    }
}

export default withRouter(Home);